<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>基础图形元素</title>
  <style>
    html, body {
      padding: 0;
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
    }
    #app {
      width: 100%;
      height: 100%;
    }
  </style>
</head>
<body>
  <div id="app"></div>
  <script src="https://unpkg.com/spritejs/dist/spritejs.min.js"></script>
  <script src="https://unpkg.com/@qcharts/core/dist/index.js"></script>
  <script>
    const { Chart, RadialBar, Legend, Tooltip } = qcharts;

    const chart = new Chart({
      container: '#app'
    });

    const data = [
      {
        type: '政法干部',
        count: 6654
      },{
        type: '平安志愿者',
        count: 5341
      },{
        type: '人民调解员',
        count: 3546
      },{
        type: '心理咨询师',
        count: 4321
      },{
        type: '法律工作者',
        count: 3923
      },{
        type: '网格员',
        count: 5345
      }
    ].sort((a, b) => a.count - b.count);

    chart.source(data, {
      row: 'type',
      text: 'type',
      value: 'count'
    });

    const radialBar = new RadialBar({
      min: 0,
      max: 10000,
      radius: 0.6,
      innerRadius: 0.1,
      lineWidth: 10
    });

    radialBar.style('arc', { lineCap: 'round' });

    const legend = new Legend({
      orient: 'vertical',
      align: ['right', 'center'],
    });

    chart.append([radialBar, legend, new Tooltip()]);
  </script>
</body>
</html>